#ifndef SGU_DXF_H
#define SGU_DXF_H

SGU_NS_BEGIN

class Dxf : NoCopy
{

	public:
	Dxf(TextOutput & text, real scale = 1);
	virtual ~Dxf();

	//void draw(const Polyarc2D &);
	void draw(const Segment2D &);
	void draw(const Circle2D &);
	void draw(const Arc2D &);
	void draw(const Point2D &);
	void draw(const Polygon2D &);
	//void draw(const std::vector<Point2D> &, bool closed);
	void draw(const Ellipse2D &);

	void drawApprox(const Ellipse2D &, size_t);


	protected:
	TextOutput & _text;
	UserObj _text_use;

	const real _scale;
	
	void fileHead();
	void fileTail();
	void polyHead(bool closed);
	void polyTail();

	void writeReal(real);
	void writeAngle(real);
	void writeRatio(real);
	void writeLayer();
	void writeCoord(const Point2D & p, char w);
	void writeVertex(const Point2D & p, real angle);

	void writeln(const char * str) {_text.writeln(str);}
	void writeln(const std::string & str) {_text.writeln(str);}
};

SGU_NS_END

#endif
